import { Redirect } from 'umi'
const useAuth=()=>{
  return window.localStorage.getItem('token')?{isLogin:true}:{isLogin:false}
}
export default (props:any) => {
  const { isLogin } = useAuth();
  if (isLogin) {
    return <div>{ props.children }</div>
  } else {
    return <Redirect to="/login" />
  }
}
